from django.db import models
from django.utils import timezone


class ReportInformation(models.Model):
    """
        举报信息表
    """
    REVIEW_TYPE_CHOICES = (
        (0, '未处理'),
        (1, '举报不成立'),
        (2, '删帖处理'),
        (3, '禁言处理'),
    )

    id = models.AutoField(primary_key=True)
    topic_id = models.IntegerField('贴子ID', default=0)
    comment_id = models.IntegerField('评论ID', default=0)
    topic_subject = models.CharField(verbose_name='贴子标题', max_length=200, default='')
    comment_content = models.CharField(verbose_name='评论内容', max_length=200, default='')
    reported_account_id = models.IntegerField('被举报的用户ID', default=0)
    category = models.SmallIntegerField(default=0, verbose_name="话题类型, TopicCategory表外键")

    report_type = models.SmallIntegerField('举报类型', default=1)
    report_content = models.CharField('补充的举报内容', max_length=150)
    review_type = models.SmallIntegerField('审核处理类型', default=0, choices=REVIEW_TYPE_CHOICES)
    review_content = models.CharField('审核补充类容', max_length=150)
    review_account_id = models.IntegerField('举报处理用户ID', default=0)
    review_time = models.DateTimeField('处理时间', default=None, null=True)

    created_by_id = models.IntegerField('创建举报的用户ID', default=0)
    created_on = models.DateTimeField('创建时间', default=timezone.now)


class ReportType(models.Model):
    """
        举报类型信息表
    """
    id = models.AutoField(primary_key=True)
    type_name = models.CharField(max_length=20, blank=False)
    enable = models.SmallIntegerField(default=0)

    def __str__(self):
        return self.type_name


class AutomaticPostComment(models.Model):
    id = models.AutoField(primary_key=True)
    topic_id = models.IntegerField('贴子ID', default=0)
    category = models.SmallIntegerField(default=0, verbose_name="话题类型, TopicCategory表外键")
    created_by_id = models.IntegerField('创建的用户ID', default=0)
    created_on = models.DateTimeField('创建时间', default=timezone.now)


class AutomaticCommentList(models.Model):
    id = models.AutoField(primary_key=True)
    content = models.CharField(verbose_name='评论内容', max_length=200)
    created_on = models.DateTimeField('创建时间', default=timezone.now)


class AutomaticAccountList(models.Model):
    id = models.AutoField(primary_key=True)
    account_id = models.IntegerField('用户ID', default=0)
    created_on = models.DateTimeField('创建时间', default=timezone.now)


class StatManual(models.Model):
    """
        统计信息控制表
    """
    id = models.AutoField(primary_key=True)
    stat_name = models.CharField(max_length=30, blank=False)
    add_value = models.IntegerField(default=0)